#include "enemyplane1.h"
#include"config.h"
ENemyplane::ENemyplane() {
    //敌机资源加载
    m_enemy1.load(ENEMY1_PATH);
    //敌机位置
    m_X=0;
    m_Y=0;
    //敌机状态
    m_Free=true;
    //敌机速度
    m_speed=ENEMY1_SPEED;
    //敌机矩形框（碰撞检测）
    m_Rect.setWidth(m_enemy1.width());
    m_Rect.setHeight(m_enemy1.height());
    m_Rect.moveTo(m_X,m_Y);

}

void ENemyplane::upadatePosition()
{
    //闲置敌机
    if(m_Free){
        return;
    }

    m_Y+=m_speed;
    m_Rect.moveTo(m_X,m_Y);
    //如果超过屏幕，重置空闲状态
    if(m_Y>=GAME_HEIGHT+m_Rect.height()){
        m_Free=true;
    }

}
